<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :mask-closable="false"
    switch-fullscreen
    :ok-button-props="{ class:{'jee-hidden': disableSubmit} }"
    cancel-text="关闭"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <VersionForm ref="realForm" :disabled="disableSubmit" normal @ok="submitCallback" />
  </j-modal>
</template>

<script>

import VersionForm from './VersionForm'

export default {
  name: 'VersionModal',
  components: {
    VersionForm
  },
  data() {
    return {
      title: '操作',
      width: 500,
      visible: false,
      disableSubmit: false
    }
  },
  methods: {
    edit(record) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.edit(record)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleOk() {
      this.$refs.realForm.submitForm()
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>

<style lang="less" scoped>
  /deep/ .ant-modal-body {
    padding: 10px !important;
  }
</style>
